package cn.seimes.zjcc.fallback;


import cn.seimes.result.JsonResult;
import cn.seimes.zjcc.dto.MovTicDto;
import cn.seimes.zjcc.feign.AllMoveTickeetService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class AMTServiceFallbackFactory implements FallbackFactory<AllMoveTickeetService> {
    @Override
    public AllMoveTickeetService create(Throwable throwable) {
        throwable.printStackTrace();
        return new AllMoveTickeetService() {
            @Override
            public JsonResult selectList() {
                return JsonResult.error("无法查询所有电影票，请稍后重试", "1");
            }

            @Override
            public JsonResult buyTick(MovTicDto dto) {
                return JsonResult.error("无法购买电影票，请稍后重试", "2");
            }

            @Override
            public JsonResult geta(Long id) {
                return JsonResult.error("无法使用电影票，请稍后重试", "3");
            }

            @Override
            public JsonResult fuli(Long id) {
                return JsonResult.error("无法给你这个蠢货送电影票，请稍后重试", "4");
            }
        };


    }
}
